home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / mxmnu239.zip / CRAWL.INC next >
Text File  |  1993-03-22  |  2KB  |  106 lines

  1.  
  2. Comment
  3. ==========================================================
  4.  
  5. This section allows for a screen crawl on the bottom line of the screen.
  6. It reads a file and displays it over and over.
  7.  
  8. If TODAY.TXT doesn't exist then no crawl will be displayed.
  9.  
  10. Blank lines in the TODAY.TXT file cause * * * to appear.
  11.  
  12. ==========================================================
  13. EndComment
  14.  
  15.  
  16. ;----- Background Tasking
  17.  
  18. var
  19.   CrawlFile = 'TODAY.TXT'     ;name of the file you want to display
  20.   CrawlDelay = 30             ;seconds to wait to start
  21.   ThisLine
  22.   NextLine
  23.   LinePtr
  24.   OldTimer
  25.   Crawl
  26.  
  27.  
  28. ;----- Setup
  29.  
  30. OldTimer = Timer
  31. IdleProgram = Loc CrawlTask
  32.  
  33.  
  34. ;----- Procedures
  35.  
  36. Procedure FillLine
  37.    while length(ThisLine) < (ScreenWidth - 2)
  38.       if NextLine = ''
  39.          NextLine = Crawl[LinePtr]
  40.          LinePtr = LinePtr + 1
  41.          if NextLine = ''
  42.             NextLine = '* * * '
  43.          else
  44.             NextLine = NextLine + ' '
  45.          endif
  46.       endif
  47.       ThisLine = ThisLine + Left(NextLine,1)
  48.       delete(NextLine,1,1)
  49.    endwhile
  50. EndProc
  51.  
  52.  
  53. Procedure CrawlTask
  54. var X
  55.  
  56. ;   if Hour = 1
  57.        ;this is where you can start something at 1:00 in the morning
  58. ;   endif
  59.  
  60.    while not KbdReady and (Timer - OldTimer < (CrawlDelay * 18))
  61.    EndWhile
  62.  
  63.    OldTimer = Timer
  64.    if KbdReady then Return
  65.  
  66.    ThisLine = ' * * * * * * * * * * '
  67.    LinePtr = 1
  68.    NextLine = ''
  69.  
  70.    ;----- Read the text file.
  71.  
  72.    if NumberOfElements(Crawl) = 0
  73.       CrawlFile = ExistOnPath(CrawlFile)
  74.       if CrawlFile = ''
  75.          IdleProgram = Nil
  76.          Return
  77.       endif
  78.       ReadTextFile (CrawlFile,Crawl)
  79.       if Crawl[NumberOfElements(Crawl)] > ''
  80.          AppendArray(Crawl,'')
  81.       endif
  82.       AppendArray(Crawl,'###')
  83.       AppendArray(Crawl,'')
  84.    endif
  85.  
  86.    SetTopWindow StatusWindow
  87.    while not KbdReady
  88.       if LinePtr > NumberOfElements(Crawl) then LinePtr = 1
  89.       FillLine
  90.       X = Timer
  91.       if (X mod 2 = 0) and (X <> OldTimer)
  92.          GotoXY 2 1
  93.          Write ThisLine
  94.          delete(ThisLine,1,1)
  95.          OldTimer = X
  96.       endif
  97.    endwhile
  98.  
  99.    ClearScreen
  100.    WriteCenter StatusLineText
  101.    SetWindowUnder (StatusWindow,StatusWindow + 1)
  102.    OldTimer = Timer
  103. EndProc
  104.  
  105.  
  106.